package org.linlinjava.litemall.wx.web;

import org.apache.ibatis.annotations.Param;
import org.linlinjava.litemall.core.util.ResponseUtil;
import org.linlinjava.litemall.db.domain.LitemallBase;
import org.linlinjava.litemall.db.domain.LitemallMoneyLog;
import org.linlinjava.litemall.db.domain.LitemallUser;
import org.linlinjava.litemall.db.service.LitemallBaseService;
import org.linlinjava.litemall.db.service.LitemallMoneyLogService;
import org.linlinjava.litemall.db.service.LitemallNewsService;
import org.linlinjava.litemall.db.service.LitemallUserService;
import org.linlinjava.litemall.wx.annotation.LoginUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/wx/newapp")
@Validated
public class WxNewAppController {

    @Autowired
    private LitemallBaseService litemallBaseService;
    @Autowired
    private LitemallNewsService litemallNewsService;

    @GetMapping("/download")
    public Object info() {
        LitemallBase litemallBase = litemallBaseService.selectBylv();
        return ResponseUtil.ok(litemallBase);
    }

    @GetMapping("page")
    public Object page(Integer page, Integer limit, String sort, String order) {
        return ResponseUtil.ok(litemallNewsService.selectallnews(page, limit, sort, order));
    }
    @GetMapping("news")
    public Object detail(@Param("newsId") Integer newsId) {
        return ResponseUtil.ok(litemallNewsService.selectByid(newsId));
    }


}
